define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'reau.refund_audit/index',
        add_url: 'reau.refund_audit/add',
        edit_url: 'reau.refund_audit/edit',
        delete_url: 'reau.refund_audit/delete',
        export_url: 'reau.refund_audit/export',
        modify_url: 'reau.refund_audit/modify',
        adopt_url: 'reau.refund_audit/adopt_url',
        reject_url: 'reau.refund_audit/reject_url',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'order_no', minWidth: 80, title: '订单号'},
                    {field: 'service_img', minWidth: 80, title: '产品图', search: false, templet: ea.table.image}, 
                    {field: 'service_name', minWidth: 80, title: '产品名称'},
                    {field: 'service_good_price', minWidth: 80, title: '产品价格',search: false},
                    {field: 'payable_money', minWidth: 80, title: '应付金额',search: false},
                    {field: 'paidin_money', minWidth: 80, title: '实付金额',search: false},
                    {field: 'type', title: '类型',selectList: {1: '单次',2: '套餐'}},
                    {field: 'status', title: '订单状态',selectList: {1: '待付款',2: '待服务',3: '待确认',4: '待评价',5: '退款',5: '退款驳回'},search: false},
                    {field: 'is_order_refund', title: '审核状态',selectList: {1: '待审核',2: '退款成功',3: '退款驳回'}},
                    {field: 'service_time', minWidth: 80, title: '服务时间',search: false},
                    {field: 'create_time', title: '下单时间',search: false},
                    {field: 'update_time', title: '申请退款时间',search: false},
                    {title: '操作', templet: ea.table.tool,operat:[
                        [
                            {
                                text: '通过',
                                title: '确定通过吗？',
                                url: init.adopt_url,
                                method: 'request',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success'
                            }
                       ],
                       [
                            {
                                text: '驳回',
                                url: init.reject_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-danger'
                            }
                        ]
                    ]},
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        reject_url: function () {
            ea.listen();
        },
    };
    return Controller;
});